package com.ego.item.api;

import com.ego.common.pojo.CartDto;
import com.ego.common.utils.PageResult;
import com.ego.item.bo.SpuBo;
import com.ego.item.pojo.Sku;
import com.ego.item.pojo.SpuDetail;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/goods")
public interface GoodsApi {
    @GetMapping("/spu/page")
    ResponseEntity<PageResult<SpuBo>> querySpuByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "rows", defaultValue = "5") Integer pageSize,
            @RequestParam(value = "saleable", required = false) Boolean saleable,
            @RequestParam(value = "key", required = false) String key);

    @PostMapping
    ResponseEntity<Void> saveGoods(@RequestBody SpuBo spuBo);

    @GetMapping("/spu/detail/{id}")
    ResponseEntity<SpuDetail> getCurSpu(@PathVariable(value = "id") Long id);

    @GetMapping("skus")
    ResponseEntity<List<Sku>> getCurSpuSkus(@RequestParam("spuId") Long spuId);

    @PutMapping
    ResponseEntity<Void> updateGoods(@RequestBody SpuBo spuBo);

    @DeleteMapping
    ResponseEntity<Void> DeleteGoods(@RequestParam("id") Long id);

    @GetMapping("/id")
    SpuBo queryGoodsById(@RequestParam(value = "spuId",required = false) Long spuId);

    @GetMapping("/sku")
    Sku getSkuBySkuId(@RequestParam("skuId") Long skuId);


}
